/*
 * 上海远境文化传媒有限公司 版权所有
 */
package facade.open.response.base;

import helper.DateTimeFormater;
import models.base.EntityLog;
import models.enums.ClientType;

/**
 * 实体日志.
 */
public class EntityLogResponse {

    public Long id;

    /**
     * 所属公司.
     */
    public String corpId;

    /**
     * 业务对象ID.
     */
    public String entityId;

    /**
     * 操作用户ID.
     */
    public String operatorId;

    /**
     * 操作用户姓名.
     */
    public String operatorName;

    /**
     * 客户端类型.
     */
    public ClientType clientType;

    public String logMessage;

    /**
     * 日志ID.
     */
    public String ttid;

    /**
     * 请求 HOST
     */
    public String requestHost;

    /**
     * 创建时间.
     */
    public String createdAt;

    public static EntityLogResponse from(EntityLog enttiyLog) {
        EntityLogResponse response = new EntityLogResponse();
        response.id = enttiyLog.getId();
        response.entityId = enttiyLog.entityId;
        response.clientType = enttiyLog.clientType;
        response.logMessage = enttiyLog.logMessage;
        response.ttid = enttiyLog.ttid;
        response.requestHost = enttiyLog.requestHost;
        response.operatorId = enttiyLog.operatorId;
        response.operatorName = enttiyLog.operatorName;
        response.createdAt  = DateTimeFormater.dt(enttiyLog.createdAt);
        return response;
    }
}
